<?php

	global $HTTP_GET_VARS;
	global $HTTP_POST_VARS;
	global $account;
	global $account_state;
	global $error;
	global $sql_row, $sql, $sql_total;
	
	if (isset($recent_from_index))
	{
		$register_slot = sql("SELECT d.product as product FROM `distribution_register` d GROUP BY d.product ORDER BY (SELECT count(*) FROM `distribution_register` e WHERE e.installed > DATE_SUB(CURDATE(),INTERVAL 30 DAY) AND e.product = d.product ) DESC LIMIT 0,2");
	}
	else
	{
		output('<p><b class="text_big">Games on Maxsi Distribution</b><br />');	
		output('Maxsi Distribution is made for games, so below you\'ll see a list of every game currently supported by Maxsi Distribution.<br /><br />');
		$register_slot = sql("SELECT product FROM `distribution_register` GROUP BY product DESC");
		
		output('</p>');
	
		$keys			=	makedefaultkeywords();	
		dopage('Upload_StartRows',$keys);
	}
	$counter=0;
	$lastproduct = '';
	do
	{
		// Not sure why we'd do this here, but incase anyone would like to have a game not show up here,
		// it could be done in that file if we modify this as well
		if (file_exists('scripts/'.$sql_row[$register_slot]['product'].'.php'))
		{
			include_once('scripts/'.$sql_row[$register_slot]['product'].'.php');
		}
		
		if (!isset($logo_100x100[$sql_row[$register_slot]['product']]))
		{
			$logo_100x100[$sql_row[$register_slot]['product']]	=	0;
		}

		$keys			=	makedefaultkeywords();			
		$keys			=	makekeywords('name',$sql_row[$register_slot]['product'],$keys);
		if ( isset($about[$sql_row[$register_slot]['product']]) )
		{	
			$keys			=	makekeywords('desc',$about[$sql_row[$register_slot]['product']],$keys);					
		}
		else
		{
			$keys			=	makekeywords('desc','',$keys);
		}
		$keys			=	makekeywords('url',ROOT . ROOT2ROOT . 'distribution/?action=showgame&amp;game='.$sql_row[$register_slot]['product'],$keys);					
		$keys			=	makekeywords('thumburl_100px',uploadid($logo_100x100[$sql_row[$register_slot]['product']]),$keys);
					
		
		dopage('upload_row',$keys);

		//output( '<a href="?action=showgame&amp;game='.$sql_row[$register_slot]['product'].'">'.$sql_row[$register_slot]['product'].'</a><br />
		//');
		$counter+=1;
	
		sql_next($register_slot);
	}
	while ($counter<$sql_total[$register_slot]);
	
	clearslot($register_slot);
		
	if (!isset($recent_from_index))
	{
		$keys			=	makedefaultkeywords();		
		dopage('Upload_EndRows',$keys);
	}
?>